// 发送单条短信示例
'use strict';
exports.main = async (event, context) => {
	console.log("发送验证码")
	console.log("电话号码：", event.phoneNumber, "验证码：", event.verifyCode)
	try {
		const res = await uniCloud.sendSms({
			appid: '__UNI__DBE84F8',
			smsKey: 'a1c08bb6311ea7e734a34fede094166e',
			smsSecret: '8608a0bddf1622d027f2a4dd7ed3ad14',
			phone: event.phoneNumber,
			templateId: '18348', // 请替换为自己申请的模板id
			data: {
				code: event.verifyCode,
				expMinute: '5',
			}
		})
		// 调用成功，请注意这时不代表发送成功
		return res
	} catch (err) {
		// 调用失败
		console.log(err.errCode)
		console.log(err.errMsg)
		return {
			code: err.errCode,
			msg: err.errMsg
		}
	}
};